home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / Script Tools / Examples / Quit All Applications < prev    next >
Text File  |  1993-09-10  |  729b  |  28 lines

  1. --
  2. --    This script asks all the non-essential applications running on your Macintosh to
  3. --    quit.  The property appsToKeep lists those applications you consider essential
  4. --
  5.  
  6. property appsToKeep : {"Finder", "Eyes", "Monitor"}
  7.  
  8. set appList to list processes
  9. repeat with i from 1 to count of appList
  10.     set appName to item i of appList
  11.     set appInfo to get process appName
  12.     if not onlyBackground of appInfo then
  13.         set skipIt to false
  14.         repeat with j from 1 to count of appsToKeep
  15.             if appName = (item j of appsToKeep) then
  16.                 set skipIt to true
  17.                 exit repeat
  18.             end if
  19.         end repeat
  20.         
  21.         if not skipIt and appName ≠ (get current process) then
  22.             tell application appName
  23.                 activate
  24.                 quit
  25.             end tell
  26.         end if
  27.     end if
  28. end repeat